
/**
 * 是否已经登录
 */
function isLoginFlag() {
  try {
    var res = wx.getStorageSync('login_flag')
    return res;
  } catch (e) {
    // Do something when catch error
    return false;
  }
}

function setLoginFlag(loginFlag) {
  wx.setStorageSync("login_flag", loginFlag);
}


/**
 * 用户ID
 */
function getUserId() {
  try {
    var res = wx.getStorageSync('user_id')
    return res;
  } catch (e) {
    // Do something when catch error
    return false;
  }
}

function setUserId(userId) {
  wx.setStorageSync("user_id", userId);
}

/**
 * 用户token
 */
function getToken() {
  try {
    var res = wx.getStorageSync('token')
    return res;
  } catch (e) {
    // Do something when catch error
    return false;
  }
}

function setToken(token) {
  wx.setStorageSync("token", token);
}

/**
 * openid
 */
function getOpenId() {
  try {
    var res = wx.getStorageSync('open_id')
    return res;
  } catch (e) {
    // Do something when catch error
    return false;
  }
}

function setOpenId(openId) {
  wx.setStorageSync("open_id", openId);
}

/**
 * 用户头像
 */
function getImg() {
  try {
    var res = wx.getStorageSync('img')
    return res;
  } catch (e) {
    // Do something when catch error
    return false;
  }
}

function setImg(img) {
  wx.setStorageSync("img", img);
}

/**
 * 用户帐号
 */
function getAccountNo() {
  try {
    var res = wx.getStorageSync('account_no')
    return res;
  } catch (e) {
    // Do something when catch error
    return false;
  }
}

function setAccountNo(accountNo) {
  wx.setStorageSync("account_no", accountNo);
}

/**
 * 昵称
 */
function getName() {
  try {
    var res = wx.getStorageSync('name')
    return res;
  } catch (e) {
    // Do something when catch error
    return false;
  }
}

function setName(name) {
  wx.setStorageSync("name", name);
}

/**
 * 手机号
 */
function getMobile() {
  try {
    var res = wx.getStorageSync('mobile')
    return res;
  } catch (e) {
    // Do something when catch error
    return false;
  }
}

function setMobile(mobile) {
  wx.setStorageSync("mobile", mobile);
}


/**
 * 手机号
 */
function getIc() {
  try {
    var res = wx.getStorageSync('ic')
    return res;
  } catch (e) {
    // Do something when catch error
    return false;
  }
}

function setIc(ic) {
  wx.setStorageSync("ic", ic);
}

/**
 * 地址数量
 */
function getAddressCount() {
  try {
    var res = wx.getStorageSync('address_count')
    return res;
  } catch (e) {
    // Do something when catch error
    return false;
  }
}

function setAddressCount(addressCount) {
  wx.setStorageSync("address_count", addressCount);
}

/**
 * 七牛token
 */
function getQiNiuToken() {
  try {
    var res = wx.getStorageSync('qi_niu_token')
    return res;
  } catch (e) {
    // Do something when catch error
    return false;
  }
}

function setQiNiuToken(qiNiuToken) {
  wx.setStorageSync("qi_niu_token", qiNiuToken);
}

/**
 * 七牛服务器地址
 */
function getDownloadPath() {
  try {
    var res = wx.getStorageSync('download_path')
    return res;
  } catch (e) {
    // Do something when catch error
    return false;
  }
}

function setDownloadPath(downloadPath) {
  wx.setStorageSync("download_path", downloadPath);
}

module.exports = {
  isLoginFlag: isLoginFlag,
  setLoginFlag: setLoginFlag,
  getUserId: getUserId,
  setUserId: setUserId,
  getToken: getToken,
  setToken: setToken,
  getOpenId: getOpenId,
  setOpenId: setOpenId,
  getImg: getImg,
  setImg: setImg,
  getAccountNo: getAccountNo,
  setAccountNo: setAccountNo,
  getName: getName,
  setName: setName,
  getMobile: getMobile,
  setMobile: setMobile,
  getIc: getIc,
  setIc: setIc,
  getAddressCount: getAddressCount,
  setAddressCount: setAddressCount,
  getQiNiuToken: getQiNiuToken,
  setQiNiuToken: setQiNiuToken,
  getDownloadPath: getDownloadPath,
  setDownloadPath: setDownloadPath
}